package com.lucy.disk.event;

import com.lucy.disk.domain.entity.FileEntity;

import java.util.ServiceLoader;

/**
 * @author kindear
 * 文件创建完成事件
 */
public interface FileCreatedEvent {
    void invoke(FileEntity o);
    default void emit(FileEntity o){
        ServiceLoader<FileCreatedEvent> serviceLoader = ServiceLoader.load(FileCreatedEvent.class);
        for (FileCreatedEvent service:serviceLoader){
            service.invoke(o);
        }
    }
}
